/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GestionEncheres.java
 *
 * Created on 22 mars 2011, 17:36:15
 */
package papacharly.encheres.ui;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import org.omg.CORBA.Object;
import papacharly.encheres.log.Logger;

/**
 *
 * @author Rudy
 */
public class GestionEncheres extends javax.swing.JFrame {

    private Logger log = Logger.getLogger(this.getClass().getSimpleName());
    private GestionEnchereHandler gestionEnchereHandler = new GestionEnchereHandler(this);
    private boolean userLoged = false;

    /** Creates new form GestionEncheres */
    public GestionEncheres() {

        initComponents();
    }

    public class QuitterAction extends javax.swing.AbstractAction {

        public QuitterAction(String texte) {
            super(texte);
        }

        public void actionPerformed(java.awt.event.ActionEvent e) {
            System.exit(0);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabManager = new javax.swing.JTabbedPane();
        connectTab = new javax.swing.JPanel();
        connectTitle = new javax.swing.JLabel();
        txtLogin = new javax.swing.JTextField();
        lblLogin = new javax.swing.JLabel();
        lblPassword = new javax.swing.JLabel();
        lslPassword = new javax.swing.JTextField();
        btnConnect = new javax.swing.JButton();
        btnLogout = new javax.swing.JButton();
        listEncheresTab = new javax.swing.JPanel();
        listEncheresTitle = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tab_lstEncheres_ = new javax.swing.JTable();
        lbl_encheres_filtres = new javax.swing.JLabel();
        lbl_encheres_categorie = new javax.swing.JLabel();
        lst_encheres_categorie = new javax.swing.JComboBox();
        btn_encheres_tout = new javax.swing.JButton();
        btn_encheres_enCours = new javax.swing.JButton();
        btn_encheres_vendu = new javax.swing.JButton();
        addProduitTab = new javax.swing.JPanel();
        addProduitTitle = new javax.swing.JLabel();
        lblLibPdt = new javax.swing.JLabel();
        txtLibPdt = new javax.swing.JTextField();
        lblDescPdt = new javax.swing.JLabel();
        lblPrixDepart = new javax.swing.JLabel();
        lblPrixImmediat = new javax.swing.JLabel();
        lblDateDebut = new javax.swing.JLabel();
        lblDateFin = new javax.swing.JLabel();
        lblCategorie = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtDescPdt = new javax.swing.JTextArea();
        txtPrixDepart = new javax.swing.JTextField();
        txtPrixImmediat = new javax.swing.JTextField();
        txtDateDebut = new javax.swing.JTextField();
        txtDateFin = new javax.swing.JTextField();
        cboxCat = new javax.swing.JComboBox();
        btnAddProduit = new javax.swing.JButton();
        encherirTab = new javax.swing.JPanel();
        registrationTitle1 = new javax.swing.JLabel();
        lbl_encherir_produit = new javax.swing.JLabel();
        list_encherir_produit = new javax.swing.JComboBox();
        lbl_encherir_dateFin = new javax.swing.JLabel();
        txt_encherir_dateFin = new javax.swing.JTextField();
        lbl_encherir_prixImmediat = new javax.swing.JLabel();
        txt_encherir_prixImmediat = new javax.swing.JTextField();
        lbl_encherir_oldEnchere = new javax.swing.JLabel();
        txt_encherir_oldEnchere = new javax.swing.JTextField();
        lbl_encherir_newEnchere = new javax.swing.JLabel();
        newEnchere = new javax.swing.JTextField();
        btn_encherir_submit = new javax.swing.JButton();
        registrationTab = new javax.swing.JPanel();
        registrationTitle = new javax.swing.JLabel();
        txtUser = new javax.swing.JTextField();
        lblUser = new javax.swing.JLabel();
        lblNomUser = new javax.swing.JLabel();
        lblAdresseUser = new javax.swing.JLabel();
        lblPrenomUser = new javax.swing.JLabel();
        txtNomUser = new javax.swing.JTextField();
        txtPrenomUser = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAdresseUser = new javax.swing.JTextArea();
        lblMailUser = new javax.swing.JLabel();
        txtMailUser = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txtPhoneUser = new javax.swing.JTextField();
        btnCreateUser = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        exitMenu = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Gestion Enchères");

        tabManager.setTabPlacement(javax.swing.JTabbedPane.LEFT);

        connectTitle.setFont(new java.awt.Font("Tahoma", 1, 15));
        connectTitle.setText("Connexion");

        lblLogin.setText("Nom d'utilisateur :");

        lblPassword.setText("Mot de passe :");

        btnConnect.setText("Connecter");
        btnConnect.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnConnectMouseClicked(evt);
            }
        });

        btnLogout.setText("Deconnecter");
        btnLogout.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnLogoutMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout connectTabLayout = new javax.swing.GroupLayout(connectTab);
        connectTab.setLayout(connectTabLayout);
        connectTabLayout.setHorizontalGroup(
            connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(connectTabLayout.createSequentialGroup()
                .addGroup(connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(connectTabLayout.createSequentialGroup()
                        .addGap(71, 71, 71)
                        .addGroup(connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblLogin)
                            .addComponent(lblPassword))
                        .addGap(18, 18, 18)
                        .addGroup(connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lslPassword)
                            .addComponent(txtLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE)))
                    .addGroup(connectTabLayout.createSequentialGroup()
                        .addGap(188, 188, 188)
                        .addComponent(btnConnect)
                        .addGap(18, 18, 18)
                        .addComponent(btnLogout))
                    .addGroup(connectTabLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(connectTitle)))
                .addContainerGap(281, Short.MAX_VALUE))
        );
        connectTabLayout.setVerticalGroup(
            connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(connectTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(connectTitle)
                .addGap(82, 82, 82)
                .addGroup(connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblLogin))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPassword)
                    .addComponent(lslPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addGroup(connectTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnConnect)
                    .addComponent(btnLogout))
                .addContainerGap(249, Short.MAX_VALUE))
        );

        tabManager.addTab("Connexion / Déconnexion", connectTab);

        listEncheresTitle.setFont(new java.awt.Font("Tahoma", 1, 15));
        listEncheresTitle.setText("Liste des enchères :");

        tab_lstEncheres_.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Nom", "Description", "Date début", "Date fin", "Prix de départ", "Prix immédiat", "Enchère", "Catégorie"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(tab_lstEncheres_);

        lbl_encheres_filtres.setText("Filtres :");

        lbl_encheres_categorie.setText("Catégorie");

        lst_encheres_categorie.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        btn_encheres_tout.setText("Tout");

        btn_encheres_enCours.setText("En cours");

        btn_encheres_vendu.setText("Vendu");

        javax.swing.GroupLayout listEncheresTabLayout = new javax.swing.GroupLayout(listEncheresTab);
        listEncheresTab.setLayout(listEncheresTabLayout);
        listEncheresTabLayout.setHorizontalGroup(
            listEncheresTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(listEncheresTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(listEncheresTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 669, Short.MAX_VALUE)
                    .addGroup(listEncheresTabLayout.createSequentialGroup()
                        .addComponent(listEncheresTitle)
                        .addContainerGap(521, Short.MAX_VALUE))
                    .addGroup(listEncheresTabLayout.createSequentialGroup()
                        .addComponent(lbl_encheres_filtres)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btn_encheres_tout)
                        .addGap(18, 18, 18)
                        .addComponent(btn_encheres_enCours)
                        .addGap(18, 18, 18)
                        .addComponent(btn_encheres_vendu)
                        .addGap(25, 25, 25)
                        .addComponent(lbl_encheres_categorie)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lst_encheres_categorie, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        listEncheresTabLayout.setVerticalGroup(
            listEncheresTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(listEncheresTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(listEncheresTitle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(listEncheresTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_encheres_filtres)
                    .addComponent(lbl_encheres_categorie)
                    .addComponent(lst_encheres_categorie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_encheres_tout)
                    .addComponent(btn_encheres_enCours)
                    .addComponent(btn_encheres_vendu))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 406, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        tabManager.addTab("Liste des enchères", listEncheresTab);

        addProduitTitle.setFont(new java.awt.Font("Tahoma", 1, 15));
        addProduitTitle.setText("Ajouter un nouveau produit");

        lblLibPdt.setText("Libellé :");

        lblDescPdt.setText("Description :");

        lblPrixDepart.setText("Prix de départ :");

        lblPrixImmediat.setText("Prix immédiat :");

        lblDateDebut.setText("Date de début :");

        lblDateFin.setText("Date de fin :");

        lblCategorie.setText("Catégorie :");

        txtDescPdt.setColumns(20);
        txtDescPdt.setRows(3);
        jScrollPane2.setViewportView(txtDescPdt);

        cboxCat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        btnAddProduit.setText("Ajouter");

        javax.swing.GroupLayout addProduitTabLayout = new javax.swing.GroupLayout(addProduitTab);
        addProduitTab.setLayout(addProduitTabLayout);
        addProduitTabLayout.setHorizontalGroup(
            addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addProduitTabLayout.createSequentialGroup()
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addProduitTabLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(addProduitTitle))
                    .addGroup(addProduitTabLayout.createSequentialGroup()
                        .addGap(104, 104, 104)
                        .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDescPdt)
                            .addComponent(lblLibPdt)
                            .addComponent(lblPrixDepart)
                            .addComponent(lblPrixImmediat)
                            .addComponent(lblDateFin)
                            .addComponent(lblCategorie)
                            .addComponent(lblDateDebut))
                        .addGap(50, 50, 50)
                        .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtLibPdt, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
                            .addComponent(txtDateFin, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                            .addComponent(txtDateDebut, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                            .addComponent(txtPrixImmediat, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                            .addComponent(txtPrixDepart, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
                            .addComponent(cboxCat, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(150, 150, 150))
            .addGroup(addProduitTabLayout.createSequentialGroup()
                .addGap(235, 235, 235)
                .addComponent(btnAddProduit)
                .addContainerGap(371, Short.MAX_VALUE))
        );

        addProduitTabLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cboxCat, txtDateDebut, txtDateFin, txtPrixDepart, txtPrixImmediat});

        addProduitTabLayout.setVerticalGroup(
            addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addProduitTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(addProduitTitle)
                .addGap(27, 27, 27)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtLibPdt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblLibPdt))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDescPdt)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPrixDepart)
                    .addComponent(txtPrixDepart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPrixImmediat)
                    .addComponent(txtPrixImmediat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDateDebut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDateDebut))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDateFin)
                    .addComponent(txtDateFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addProduitTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCategorie)
                    .addComponent(cboxCat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addComponent(btnAddProduit)
                .addContainerGap(118, Short.MAX_VALUE))
        );

        tabManager.addTab("Proposer un produit", addProduitTab);

        registrationTitle1.setFont(new java.awt.Font("Tahoma", 1, 15));
        registrationTitle1.setText("Réaliser une enchère");

        lbl_encherir_produit.setText("Produit :");

        list_encherir_produit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        lbl_encherir_dateFin.setText("Date de fin :");

        txt_encherir_dateFin.setEditable(false);

        lbl_encherir_prixImmediat.setText("Prix immédiat :");

        txt_encherir_prixImmediat.setEditable(false);

        lbl_encherir_oldEnchere.setText("Enchère en cours :");

        txt_encherir_oldEnchere.setEditable(false);

        lbl_encherir_newEnchere.setText("Votre enchère :");

        btn_encherir_submit.setText("Enchérir");

        javax.swing.GroupLayout encherirTabLayout = new javax.swing.GroupLayout(encherirTab);
        encherirTab.setLayout(encherirTabLayout);
        encherirTabLayout.setHorizontalGroup(
            encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(encherirTabLayout.createSequentialGroup()
                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(encherirTabLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(encherirTabLayout.createSequentialGroup()
                                .addComponent(registrationTitle1)
                                .addGap(89, 89, 89))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, encherirTabLayout.createSequentialGroup()
                                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lbl_encherir_produit)
                                    .addComponent(lbl_encherir_prixImmediat)
                                    .addComponent(lbl_encherir_dateFin)
                                    .addComponent(lbl_encherir_oldEnchere)
                                    .addComponent(lbl_encherir_newEnchere))
                                .addGap(25, 25, 25)))
                        .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(newEnchere)
                            .addComponent(txt_encherir_oldEnchere)
                            .addComponent(txt_encherir_dateFin, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)
                            .addComponent(txt_encherir_prixImmediat)
                            .addComponent(list_encherir_produit, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(encherirTabLayout.createSequentialGroup()
                        .addGap(221, 221, 221)
                        .addComponent(btn_encherir_submit)))
                .addContainerGap(295, Short.MAX_VALUE))
        );
        encherirTabLayout.setVerticalGroup(
            encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(encherirTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(registrationTitle1)
                .addGap(43, 43, 43)
                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(list_encherir_produit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_encherir_produit))
                .addGap(18, 18, 18)
                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_encherir_dateFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_encherir_dateFin))
                .addGap(18, 18, 18)
                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_encherir_prixImmediat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_encherir_prixImmediat))
                .addGap(18, 18, 18)
                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_encherir_oldEnchere, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_encherir_oldEnchere))
                .addGap(18, 18, 18)
                .addGroup(encherirTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(newEnchere, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_encherir_newEnchere))
                .addGap(38, 38, 38)
                .addComponent(btn_encherir_submit)
                .addContainerGap(154, Short.MAX_VALUE))
        );

        tabManager.addTab("Faire une enchère", encherirTab);

        registrationTitle.setFont(new java.awt.Font("Tahoma", 1, 15));
        registrationTitle.setText("Création d'un compte utilisateur");

        lblUser.setText("Nom d'utilisateur :");

        lblNomUser.setText("Nom :");

        lblAdresseUser.setText("Adresse :");

        lblPrenomUser.setText("Prénom :");

        txtAdresseUser.setColumns(20);
        txtAdresseUser.setRows(3);
        jScrollPane1.setViewportView(txtAdresseUser);

        lblMailUser.setText("E-Mail :");

        jLabel7.setText("Téléphone :");

        btnCreateUser.setText("S'enregistrer");
        btnCreateUser.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCreateUserMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout registrationTabLayout = new javax.swing.GroupLayout(registrationTab);
        registrationTab.setLayout(registrationTabLayout);
        registrationTabLayout.setHorizontalGroup(
            registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(registrationTabLayout.createSequentialGroup()
                .addGap(220, 220, 220)
                .addComponent(btnCreateUser)
                .addContainerGap(354, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, registrationTabLayout.createSequentialGroup()
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(registrationTabLayout.createSequentialGroup()
                        .addGap(98, 98, 98)
                        .addComponent(lblUser)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtUser, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(registrationTabLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(registrationTitle))
                        .addGroup(registrationTabLayout.createSequentialGroup()
                            .addGap(98, 98, 98)
                            .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblNomUser)
                                .addComponent(lblPrenomUser)
                                .addComponent(lblAdresseUser)
                                .addComponent(lblMailUser)
                                .addComponent(jLabel7))
                            .addGap(33, 33, 33)
                            .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                                .addComponent(txtPhoneUser, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                                .addComponent(txtMailUser, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                                .addComponent(txtPrenomUser, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                                .addComponent(txtNomUser, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)))))
                .addGap(262, 262, 262))
        );
        registrationTabLayout.setVerticalGroup(
            registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(registrationTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(registrationTitle)
                .addGap(53, 53, 53)
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblUser))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNomUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNomUser))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPrenomUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblPrenomUser))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblAdresseUser)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtMailUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMailUser))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(registrationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPhoneUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addComponent(btnCreateUser)
                .addContainerGap(133, Short.MAX_VALUE))
        );

        tabManager.addTab("Créer un compte", registrationTab);

        fileMenu.setText("Fichier");

        exitMenu.setAction(new QuitterAction("Quitter"));
        exitMenu.setText("Quitter");
        fileMenu.add(exitMenu);

        menuBar.add(fileMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabManager, javax.swing.GroupLayout.DEFAULT_SIZE, 846, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabManager, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCreateUserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCreateUserMouseClicked
        log.debug("btnCreateUserMouseClicked");
        gestionEnchereHandler.createUser();
    }//GEN-LAST:event_btnCreateUserMouseClicked

    private void btnLogoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnLogoutMouseClicked
        log.debug("btnLogoutMouseClicked");
        gestionEnchereHandler.logout();
    }//GEN-LAST:event_btnLogoutMouseClicked

    private void btnConnectMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnConnectMouseClicked
        log.debug("btnConnectMouseClicked");
        gestionEnchereHandler.login();
    }//GEN-LAST:event_btnConnectMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new GestionEncheres().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel addProduitTab;
    private javax.swing.JLabel addProduitTitle;
    private javax.swing.JButton btnAddProduit;
    private javax.swing.JButton btnConnect;
    private javax.swing.JButton btnCreateUser;
    private javax.swing.JButton btnLogout;
    private javax.swing.JButton btn_encheres_enCours;
    private javax.swing.JButton btn_encheres_tout;
    private javax.swing.JButton btn_encheres_vendu;
    private javax.swing.JButton btn_encherir_submit;
    private javax.swing.JComboBox cboxCat;
    private javax.swing.JPanel connectTab;
    private javax.swing.JLabel connectTitle;
    private javax.swing.JPanel encherirTab;
    private javax.swing.JMenuItem exitMenu;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JLabel lblAdresseUser;
    private javax.swing.JLabel lblCategorie;
    private javax.swing.JLabel lblDateDebut;
    private javax.swing.JLabel lblDateFin;
    private javax.swing.JLabel lblDescPdt;
    private javax.swing.JLabel lblLibPdt;
    private javax.swing.JLabel lblLogin;
    private javax.swing.JLabel lblMailUser;
    private javax.swing.JLabel lblNomUser;
    private javax.swing.JLabel lblPassword;
    private javax.swing.JLabel lblPrenomUser;
    private javax.swing.JLabel lblPrixDepart;
    private javax.swing.JLabel lblPrixImmediat;
    private javax.swing.JLabel lblUser;
    private javax.swing.JLabel lbl_encheres_categorie;
    private javax.swing.JLabel lbl_encheres_filtres;
    private javax.swing.JLabel lbl_encherir_dateFin;
    private javax.swing.JLabel lbl_encherir_newEnchere;
    private javax.swing.JLabel lbl_encherir_oldEnchere;
    private javax.swing.JLabel lbl_encherir_prixImmediat;
    private javax.swing.JLabel lbl_encherir_produit;
    private javax.swing.JPanel listEncheresTab;
    private javax.swing.JLabel listEncheresTitle;
    private javax.swing.JComboBox list_encherir_produit;
    private javax.swing.JTextField lslPassword;
    private javax.swing.JComboBox lst_encheres_categorie;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JTextField newEnchere;
    private javax.swing.JPanel registrationTab;
    private javax.swing.JLabel registrationTitle;
    private javax.swing.JLabel registrationTitle1;
    private javax.swing.JTabbedPane tabManager;
    private javax.swing.JTable tab_lstEncheres_;
    private javax.swing.JTextArea txtAdresseUser;
    private javax.swing.JTextField txtDateDebut;
    private javax.swing.JTextField txtDateFin;
    private javax.swing.JTextArea txtDescPdt;
    private javax.swing.JTextField txtLibPdt;
    private javax.swing.JTextField txtLogin;
    private javax.swing.JTextField txtMailUser;
    private javax.swing.JTextField txtNomUser;
    private javax.swing.JTextField txtPhoneUser;
    private javax.swing.JTextField txtPrenomUser;
    private javax.swing.JTextField txtPrixDepart;
    private javax.swing.JTextField txtPrixImmediat;
    private javax.swing.JTextField txtUser;
    private javax.swing.JTextField txt_encherir_dateFin;
    private javax.swing.JTextField txt_encherir_oldEnchere;
    private javax.swing.JTextField txt_encherir_prixImmediat;
    // End of variables declaration//GEN-END:variables

    // <editor-fold defaultstate="collapsed" desc="Methods">
    public void displayMdp(final String mdp) {
        JOptionPane.showMessageDialog(this, "Please remember your new password : " + mdp, "Password", JOptionPane.WARNING_MESSAGE);
    }

    public void displayLoginKo() {
        JOptionPane.showMessageDialog(this, "Veuillez corriger le login et/ou le mot de passe saisie", "Login", JOptionPane.INFORMATION_MESSAGE);
    }

    public void displayLogoutKo() {
        JOptionPane.showMessageDialog(this, "Impossible de procéder à la déconnexion", "Logout", JOptionPane.WARNING_MESSAGE);
    }

    /**
     * Handle the state of the Login and Create User tabs.
     * @param isLoggedIn True mean the user is loged in false mean he's not.
     */
    public void setLoginState(boolean isLoggedIn) {
        userLoged = isLoggedIn;

        if (userLoged) {
            btnCreateUser.setEnabled(Boolean.FALSE);
            btnConnect.setEnabled(Boolean.FALSE);
            btnLogout.setEnabled(Boolean.TRUE);
        } else {
            btnCreateUser.setEnabled(Boolean.TRUE);
            btnConnect.setEnabled(Boolean.TRUE);
            btnLogout.setEnabled(Boolean.FALSE);
        }
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Getters">
    public JPanel getAddProduitTab() {
        return addProduitTab;
    }

    public JLabel getAddProduitTitle() {
        return addProduitTitle;
    }

    public JButton getBtnAddProduit() {
        return btnAddProduit;
    }

    public JButton getBtnConnect() {
        return btnConnect;
    }

    public JButton getBtn_encheres_enCours() {
        return btn_encheres_enCours;
    }

    public JButton getBtn_encheres_tout() {
        return btn_encheres_tout;
    }

    public JButton getBtn_encheres_vendu() {
        return btn_encheres_vendu;
    }

    public JButton getBtn_encherir_submit() {
        return btn_encherir_submit;
    }

    public JComboBox getCboxCat() {
        return cboxCat;
    }

    public JPanel getConnectTab() {
        return connectTab;
    }

    public JLabel getConnectTitle() {
        return connectTitle;
    }

    public JPanel getEncherirTab() {
        return encherirTab;
    }

    public JMenuItem getExitMenu() {
        return exitMenu;
    }

    public JMenu getFileMenu() {
        return fileMenu;
    }

    public GestionEnchereHandler getGestionEnchereHandler() {
        return gestionEnchereHandler;
    }

    public JButton getBtnCreateUser() {
        return btnCreateUser;
    }

    public JButton getBtnLogout() {
        return btnLogout;
    }

    public JLabel getjLabel7() {
        return jLabel7;
    }

    public JScrollPane getjScrollPane1() {
        return jScrollPane1;
    }

    public JScrollPane getjScrollPane2() {
        return jScrollPane2;
    }

    public JScrollPane getjScrollPane3() {
        return jScrollPane3;
    }

    public JLabel getLblAdresseUser() {
        return lblAdresseUser;
    }

    public JLabel getLblCategorie() {
        return lblCategorie;
    }

    public JLabel getLblDateDebut() {
        return lblDateDebut;
    }

    public JLabel getLblDateFin() {
        return lblDateFin;
    }

    public JLabel getLblDescPdt() {
        return lblDescPdt;
    }

    public JLabel getLblLibPdt() {
        return lblLibPdt;
    }

    public JLabel getLblLogin() {
        return lblLogin;
    }

    public JLabel getLblMailUser() {
        return lblMailUser;
    }

    public JLabel getLblNomUser() {
        return lblNomUser;
    }

    public JLabel getLblPassword() {
        return lblPassword;
    }

    public JLabel getLblPrenomUser() {
        return lblPrenomUser;
    }

    public JLabel getLblPrixDepart() {
        return lblPrixDepart;
    }

    public JLabel getLblPrixImmediat() {
        return lblPrixImmediat;
    }

    public JLabel getLblUser() {
        return lblUser;
    }

    public JLabel getLbl_encheres_categorie() {
        return lbl_encheres_categorie;
    }

    public JLabel getLbl_encheres_filtres() {
        return lbl_encheres_filtres;
    }

    public JLabel getLbl_encherir_dateFin() {
        return lbl_encherir_dateFin;
    }

    public JLabel getLbl_encherir_newEnchere() {
        return lbl_encherir_newEnchere;
    }

    public JLabel getLbl_encherir_oldEnchere() {
        return lbl_encherir_oldEnchere;
    }

    public JLabel getLbl_encherir_prixImmediat() {
        return lbl_encherir_prixImmediat;
    }

    public JLabel getLbl_encherir_produit() {
        return lbl_encherir_produit;
    }

    public JPanel getListEncheresTab() {
        return listEncheresTab;
    }

    public JLabel getListEncheresTitle() {
        return listEncheresTitle;
    }

    public JComboBox getList_encherir_produit() {
        return list_encherir_produit;
    }

    public Logger getLog() {
        return log;
    }

    public JTextField getLslPassword() {
        return lslPassword;
    }

    public JComboBox getLst_encheres_categorie() {
        return lst_encheres_categorie;
    }

//    public JMenuBar getMenuBar() {
//        return menuBar;
//    }
    public JTextField getNewEnchere() {
        return newEnchere;
    }

    public JPanel getRegistrationTab() {
        return registrationTab;
    }

    public JLabel getRegistrationTitle() {
        return registrationTitle;
    }

    public JLabel getRegistrationTitle1() {
        return registrationTitle1;
    }

    public JTabbedPane getTabManager() {
        return tabManager;
    }

    public JTable getTab_lstEncheres_() {
        return tab_lstEncheres_;
    }

    public JTextArea getTxtAdresseUser() {
        return txtAdresseUser;
    }

    public JTextField getTxtDateDebut() {
        return txtDateDebut;
    }

    public JTextField getTxtDateFin() {
        return txtDateFin;
    }

    public JTextArea getTxtDescPdt() {
        return txtDescPdt;
    }

    public JTextField getTxtLibPdt() {
        return txtLibPdt;
    }

    public JTextField getTxtLogin() {
        return txtLogin;
    }

    public JTextField getTxtMailUser() {
        return txtMailUser;
    }

    public JTextField getTxtNomUser() {
        return txtNomUser;
    }

    public JTextField getTxtPhoneUser() {
        return txtPhoneUser;
    }

    public JTextField getTxtPrenomUser() {
        return txtPrenomUser;
    }

    public JTextField getTxtPrixDepart() {
        return txtPrixDepart;
    }

    public JTextField getTxtPrixImmediat() {
        return txtPrixImmediat;
    }

    public JTextField getTxtUser() {
        return txtUser;
    }

    public JTextField getTxt_encherir_dateFin() {
        return txt_encherir_dateFin;
    }

    public JTextField getTxt_encherir_oldEnchere() {
        return txt_encherir_oldEnchere;
    }

    public JTextField getTxt_encherir_prixImmediat() {
        return txt_encherir_prixImmediat;
    }

    public boolean isUserLoged() {
        return userLoged;
    }

    public void setUserLoged(boolean userLoged) {
        this.userLoged = userLoged;
    }
    // </editor-fold>
}
